//
// Created by LiuDongPeng on 2023/11/16.
//

#ifndef FOC_FOC_H
#define FOC_FOC_H

#include <tuple>

#include "main.h"
#include "arm_math.h"


void foc_clark(float ia, float ib, float* ialpha, float* ibeta);
void foc_inv_clark();

void foc_park(float ialpha, float ibeta, float sinTheta, float cosTheta, float* id, float* iq);
void foc_inv_park(float ud, float uq, float sinTheta, float cosTheta, float* ualpha, float* ubeta);

void foc_svpwm(float ualpha, float ubeta, float udc, float tpwm,
               float* ta, float* tb, float* tc);

std::tuple<bool, float, float, float> odriver_svm(float ualpha, float ubeta);
std::tuple<bool, float, float, float> mid_point_svm(float ualpha, float ubeta, float VBus);

#endif //FOC_FOC_H
